package com.mxf.code.redisclock;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * Copyright (C), 2017-2022, mxf
 * Author: 28382
 * Date: 2022/10/25 22:29
 * FileName: TestRedisLock
 * Description: 测试锁
 */
@Slf4j
@Component
public class TestRedisLock {

    @RedisLockAnnotation(typeEnum = RedisLockTypeEnum.ONE, lockTime = 3)
    //@Scheduled(cron = "*/5 * * * * *")
    public void testR() {
        try {
            log.info("睡眠执行前");
            Thread.sleep(10000);
            log.info("睡眠执行后");
        } catch (Exception e) {
            // log error
            log.info("has some error", e);
        }
    }
}
